Optimal. Leaf size=96 \[ \frac{\left (a^2-2 b^2\right ) \cot (c+d x)}{3 d}+\frac{a b \tanh ^{-1}(\cos (c+d x))}{d}-\frac{a b \cot (c+d x) \csc (c+d x)}{3 d}-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}+b^2 (-x) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.389709, antiderivative size = 96, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 6, integrand size = 29, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.207, Rules used = {2889, 3048, 3031, 3021, 2735, 3770} \[ \frac{\left (a^2-2 b^2\right ) \cot (c+d x)}{3 d}+\frac{a b \tanh ^{-1}(\cos (c+d x))}{d}-\frac{a b \cot (c+d x) \csc (c+d x)}{3 d}-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}+b^2 (-x) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2889
Rule 3048
Rule 3031
Rule 3021
Rule 2735
Rule 3770
Rubi steps
\begin{align*} \int \cot ^2(c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=\int \csc ^4(c+d x) (a+b \sin (c+d x))^2 \left (1-\sin ^2(c+d x)\right ) \, dx\\ &=-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}+\frac{1}{3} \int \csc ^3(c+d x) (a+b \sin (c+d x)) \left (2 b-a \sin (c+d x)-3 b \sin ^2(c+d x)\right ) \, dx\\ &=-\frac{a b \cot (c+d x) \csc (c+d x)}{3 d}-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}-\frac{1}{6} \int \csc ^2(c+d x) \left (2 \left (a^2-2 b^2\right )+6 a b \sin (c+d x)+6 b^2 \sin ^2(c+d x)\right ) \, dx\\ &=\frac{\left (a^2-2 b^2\right ) \cot (c+d x)}{3 d}-\frac{a b \cot (c+d x) \csc (c+d x)}{3 d}-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}-\frac{1}{6} \int \csc (c+d x) \left (6 a b+6 b^2 \sin (c+d x)\right ) \, dx\\ &=-b^2 x+\frac{\left (a^2-2 b^2\right ) \cot (c+d x)}{3 d}-\frac{a b \cot (c+d x) \csc (c+d x)}{3 d}-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}-(a b) \int \csc (c+d x) \, dx\\ &=-b^2 x+\frac{a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac{\left (a^2-2 b^2\right ) \cot (c+d x)}{3 d}-\frac{a b \cot (c+d x) \csc (c+d x)}{3 d}-\frac{\cot (c+d x) \csc ^2(c+d x) (a+b \sin (c+d x))^2}{3 d}\\ \end{align*}
Mathematica [B] time = 6.16953, size = 538, normalized size = 5.6 \[ \frac{\sin ^2(c+d x) \csc \left (\frac{1}{2} (c+d x)\right ) \left (a^2 \cos \left (\frac{1}{2} (c+d x)\right )-3 b^2 \cos \left (\frac{1}{2} (c+d x)\right )\right ) (a \csc (c+d x)+b)^2}{6 d (a+b \sin (c+d x))^2}+\frac{\sin ^2(c+d x) \sec \left (\frac{1}{2} (c+d x)\right ) \left (3 b^2 \sin \left (\frac{1}{2} (c+d x)\right )-a^2 \sin \left (\frac{1}{2} (c+d x)\right )\right ) (a \csc (c+d x)+b)^2}{6 d (a+b \sin (c+d x))^2}-\frac{a^2 \sin ^2(c+d x) \cot \left (\frac{1}{2} (c+d x)\right ) \csc ^2\left (\frac{1}{2} (c+d x)\right ) (a \csc (c+d x)+b)^2}{24 d (a+b \sin (c+d x))^2}+\frac{a^2 \sin ^2(c+d x) \tan \left (\frac{1}{2} (c+d x)\right ) \sec ^2\left (\frac{1}{2} (c+d x)\right ) (a \csc (c+d x)+b)^2}{24 d (a+b \sin (c+d x))^2}-\frac{b^2 (c+d x) \sin ^2(c+d x) (a \csc (c+d x)+b)^2}{d (a+b \sin (c+d x))^2}-\frac{a b \sin ^2(c+d x) \csc ^2\left (\frac{1}{2} (c+d x)\right ) (a \csc (c+d x)+b)^2}{4 d (a+b \sin (c+d x))^2}-\frac{a b \sin ^2(c+d x) \log \left (\sin \left (\frac{1}{2} (c+d x)\right )\right ) (a \csc (c+d x)+b)^2}{d (a+b \sin (c+d x))^2}+\frac{a b \sin ^2(c+d x) \sec ^2\left (\frac{1}{2} (c+d x)\right ) (a \csc (c+d x)+b)^2}{4 d (a+b \sin (c+d x))^2}+\frac{a b \sin ^2(c+d x) \log \left (\cos \left (\frac{1}{2} (c+d x)\right )\right ) (a \csc (c+d x)+b)^2}{d (a+b \sin (c+d x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.077, size = 114, normalized size = 1.2 \begin{align*} -{\frac{{a}^{2} \left ( \cos \left ( dx+c \right ) \right ) ^{3}}{3\,d \left ( \sin \left ( dx+c \right ) \right ) ^{3}}}-{\frac{ab \left ( \cos \left ( dx+c \right ) \right ) ^{3}}{d \left ( \sin \left ( dx+c \right ) \right ) ^{2}}}-{\frac{ab\cos \left ( dx+c \right ) }{d}}-{\frac{ab\ln \left ( \csc \left ( dx+c \right ) -\cot \left ( dx+c \right ) \right ) }{d}}-{b}^{2}x-{\frac{{b}^{2}\cot \left ( dx+c \right ) }{d}}-{\frac{{b}^{2}c}{d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.56373, size = 111, normalized size = 1.16 \begin{align*} -\frac{6 \,{\left (d x + c + \frac{1}{\tan \left (d x + c\right )}\right )} b^{2} - 3 \, a b{\left (\frac{2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} + \log \left (\cos \left (d x + c\right ) + 1\right ) - \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + \frac{2 \, a^{2}}{\tan \left (d x + c\right )^{3}}}{6 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.51407, size = 423, normalized size = 4.41 \begin{align*} \frac{2 \,{\left (a^{2} - 3 \, b^{2}\right )} \cos \left (d x + c\right )^{3} + 6 \, b^{2} \cos \left (d x + c\right ) + 3 \,{\left (a b \cos \left (d x + c\right )^{2} - a b\right )} \log \left (\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) \sin \left (d x + c\right ) - 3 \,{\left (a b \cos \left (d x + c\right )^{2} - a b\right )} \log \left (-\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) \sin \left (d x + c\right ) - 6 \,{\left (b^{2} d x \cos \left (d x + c\right )^{2} - b^{2} d x - a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \,{\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.26827, size = 225, normalized size = 2.34 \begin{align*} \frac{a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 6 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 24 \,{\left (d x + c\right )} b^{2} - 24 \, a b \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}\right ) - 3 \, a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 12 \, b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + \frac{44 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 3 \, a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 12 \, b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 6 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - a^{2}}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3}}}{24 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]